// 导入vue-router工厂函数
import { createWebHashHistory, createRouter } from 'vue-router';
import { shallowRef } from 'vue';
import login from "../views/login/index.vue";
import Layout from "../layout/index.vue";
import notFind from '@/views/ErrorMessage/404.vue'

// 静态路由
export const constantRouter = [
	{
		path: "/login",
		name: login,
		hidden: true,
		component: login,
	},
	{
		path: '/:path(.*)',
		component: notFind,
		hidden: true,
	},
	// 首页
	{
		path: "/",
		component: Layout,
		redirect: "/dashboard",
		meta: { requiresAuth: true, title: "首页", icon: "home" },
		children: [
			{
				path: "dashboard",
				name: "dashboard",
				component: () => import("../views/home/index.vue"),
			},
		],
	},
	// 栏目管理
	{
		path: "/userManage",
		component: Layout,
		meta: { requiresAuth: true, title: "用户管理", icon: "shop" },
		children: [
			{
				path: "/mobileUser",
				name: "mobileUser",
				component: () => import("@/views/userManage/mobileUser/index.vue"),
				meta: { requiresAuth: true, title: "app用户", icon: "shop" },
			},
			{
				path: "/adminUser",
				name: "adminUser",
				component: () => import("@/views/userManage/adminUser/index.vue"),
				meta: { requiresAuth: true, title: "admin用户", icon: "shop" },
			},
		],
	},
	// 视频上传
	{
		path: "/videoCenter",
		component: Layout,
		meta: { requiresAuth: true, title: "视频中心", icon: "shop" },
		children: [
			{
				path: "/uploadVideo",
				name: "uploadVideo",
				component: () => import("@/views/videoCenter/uploadVideo/index.vue"),
				meta: { requiresAuth: true, title: "视频上传", icon: "shop" },
			},
			{
				path: "/videoList",
				name: "videoList",
				component: () => import("@/views/videoCenter/videoList/index.vue"),
				meta: { requiresAuth: true, title: "视频列表", icon: "shop" },
			},
			{
				path: "/uploadVideoDetail",
				name: "uploadVideoDetail",
				component: () => import("@/views/videoCenter/uploadVideoDetail/index.vue"),
				hidden: true
			},
		],
	},
	// {
	//     path: "",
	//     component: Layout,
	//     meta: {requiresAuth: true, title: "视频上传", icon: "shop"},
	//     children: [
	//         {
	//             path: "/uploadVideo",
	//             name: "uploadVideo",
	//             component: () => import("@/views/fileUpload/index.vue"),
	//             meta: {requiresAuth: true, title: "视频上传", icon: "shop"},
	//         },
	//     ],
	// },
]
const router = createRouter({
	history: createWebHashHistory(),
	routes: [...constantRouter]
});


export default router;
